package com.itheima.tlias.vo;

import lombok.Data;

/**
 * 后端统一返回Result
 */
@Data
public class Result<T> {

    private Integer code;
    private String msg;
    private T data;

    public static<E> Result<E> success() {
        Result<E> result = new Result<>();
        result.code = 1;
        return result;
    }

    public static<E>  Result<E>  success(E object) {
        Result<E> result = new Result<>();
        result.data = object;
        result.code = 1;
        return result;
    }

    public static<E>  Result<E>  error(String msg) {
        Result<E> result = new Result<>();
        result.msg = msg;
        result.code = 0;
        return result;
    }

}
